package calculator.controller;/*
 * @author     ：zhangbo
 * @date       ：Created in 2021/5/22 12:07
 * @description：负责处理用户单击倒数按钮触发的ActionEvent事件。
 * @modified By：zhangbo
 * @version:     $
 */

import calculator.model.Reciprocal;
import calculator.view.CalculatorWindows;

import java.awt.event.ActionEvent;

public class HandleReciprocal extends HandleEvent {

    public HandleReciprocal(CalculatorWindows window) {
        super(window);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        String mess = "1/" + window.computer.getTempResult();
        window.computer.initDataItemByMath(new Reciprocal());
        mess += " = " + window.computer.getResult();
        window.resultShow.setText(mess);
        window.saveComputerProcess.setText(mess);
        window.computer.operator.pop();
    }
}
